\section{find --- Find non-zero elements}
\label{fn:find}
\index{find()}
\index{find non-zero elements}
\begin{rail}
Find : 'find' '(' Matrix ')' ;
\end{rail}

\verb+find+ finds the indices of the non-zero elements of the argument
matrix.  The argument is treated as being a vector, so the return
values are just element numbers, not row and column numbers.  The
format of the return values is a row vector.

This function can be used to test for elements that meet a certain criteria.

\paragraph{Example}
\index{example of find()}
\index{find()!example}
\begin{verbatim}
> b = eye(3,3)
 b =
        1          0          0  
        0          1          0  
        0          0          1  
> find(b)
        1          5          9  
> c = [nan(),3,0,2,0,0,1.43,inf()]
 c =
 matrix columns 1 thru 7
      NaN          3          0          2          0          0       1.43  

 matrix columns 8 thru 8
 Infinity  
> c = [3,0,2,0,0,1.43,inf()]
 c =
 matrix columns 1 thru 7
        3          0          2          0          0       1.43   Infinity  

> find(c)
        1          3          6          7  
> d = rand(2,5)
 d =
      0.7     0.0918       0.96      0.441      0.924  
     0.95      0.902      0.915     0.0735     0.0882  
> d < .5
        0          1          0          1          0  
        0          0          0          1          1  
> find(d < .5)
        3          7          8         10  
\end{verbatim}

See also: Page~\pageref{fn:all} \verb+all()+,
Page~\pageref{fn:any} \verb+any()+.

\newpage





